package com.langyu;

import java.util.Arrays;

public class ArrayReorder {
    public static void reorder(int[] array) {
        int i = 0;
        int j = array.length - 1;
        while (i < j) {
            while (i < j && array[i] % 2 != 0) {
                i++;
            }
            while (i < j && (array[i] & 2) == 0) {
                j--;
            }
            int temp = array[i];
            array[i] = array[j];
            array[j] = temp;
        }
    }
    public static void main(String[] args){
        int array[] = {3,5,7,9,2,4,15};
        reorder(array);
        System.out.println(Arrays.toString(array));
    }
}

